<?php 
include "includes/session.php";
include "includes/comunes.php";


$sql="select * from vehiculo where idAuto=".$_GET['aut_id'];
$resPer=cons_sql_up($sql);
$regPer=mysql_fetch_array($resPer);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema de Gestion de Vehiculos</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->
<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<link rel="stylesheet" type="text/css" href="jquery-ui/css/ui-flexigrid/flexigrid.css">
    <script type="text/javascript" src="jquery-ui/js/flexigrid.js"></script>
<!--fin libreria-->
<!--estilo para el scroll-->
<style>
  .ui-autocomplete {
    max-height: 300px;
    overflow-y: auto;
    /* prevent horizontal scrollbar */
    overflow-x: hidden;
  }
  /* IE 6 doesn't support max-height
   * we use height instead, but this forces the menu to always be this tall
   */
  * html .ui-autocomplete {
    height: 300px;
  }
  </style>
<!--
  fin estilo scroll-->


<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#marca').chainSelect('#modelo','combomarcamodelo.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        $('#modelo').chainSelect('#version','combomodeloversion.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        
           $('#venpro').chainSelect('#venloc','comboprolocalidad.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
//        fin funcion

// busco datos en caso de que existA

$("#imgbus").click(function(evento){
      evento.preventDefault();
      $("#vendedor").load("datosVendedor.php", {dni: $("#vendni").val()});
   });
   
   
  $("#imgbus").click(function(evento){
      evento.preventDefault();
      $("#vendedor").load("datosVendedor.php", {dni: $("#vendni").val()});
   }); 
   
  $('#flex1').flexigrid({
      colModel : [
                
		{display: 'Movimiento', name : 'accionistaId', width : 80, sortable : true, align: 'center'},
		{display: 'Tipo', name : 'dni', width : 100, sortable : true, align: 'left'},
		{display: 'Concepto', name : 'nomyape', width : 350, sortable : true, align: 'left'},
	    {display: 'Monto', name : 'nomyape', width : 130, sortable : true, align: 'left'},
		],
                
                height: 150
              
  });



//          funcion que implementa autocompletado de articulos
     
// $( "#fechapla" ).datepicker({
//         dateFormat: "yy-mm-dd"
//
//      });


		
		$( "#vendni" ).autocomplete({
			source: "autoPersona.php"
		});
                
                $( "#accdni" ).autocomplete({
			source: "autoAccionista.php"
		});
                $( "#accdni1" ).autocomplete({
			source: "autoAccionista.php"
		});
                $( "#accdni2" ).autocomplete({
			source: "autoAccionista.php"
		});
              

//          fin funcion



//              funcion para validacion de formularios

             $("#altavehiculo").submit(function () {

                  if (confirm('Esta seguro que confirma el pedido?')){ 
					   return true;
					}else
					   return false;
                    
                

             

             
   
          
            
        });

//              fin funcion
      $("#accpor").change(function(){
               
                        var1=($("#accpor").val())/100;
                        var2=$("#preciotoma").val();
                        monto=var1*var2;
                       
                       $("#accmon").val(monto); 
                         

             });
             
          $("#accpor1").change(function(){
               
                        var1=($("#accpor1").val())/100;
                        var2=$("#preciotoma").val();
                        monto=var1*var2;
                       
                       $("#accmon1").val(monto); 
                         

             });   
             
             $("#accpor2").change(function(){
               
                        var1=($("#accpor2").val())/100;
                        var2=$("#preciotoma").val();
                        monto=var1*var2;
                       
                       $("#accmon2").val(monto); 
                         

             });
             
             
             
             //calculo el porcentaje de venta en caso de ser necesario
              $("#por").change(function(){
               
                        var1=($("#por").val())/100;
                        var2=$("#preciocosto").val();
                        monto=(parseFloat(var1*var2)+parseFloat(var2));
                      
                       
                       $("#precioventa").val(monto); 
                         

             });
             

});
</script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal">
          <?php include 'includes/submenu.php';?>  
           <img src="img/movimientos.jpg" width="25" height="25" border="0"/> Registrar Gastos
           </div>
       <form id="pedido" name="pedido" method="POST" action="grabarMovimiento.php">
       <div class="contenedorpedido">
           <div id="vendedor">
           <fieldset>
              <legend><b>Datos del Vehiculo</b></legend> 
               <table  width="100%">
                 <tr>
                      <input type="hidden"  value="2" name="origen"> 
                      
                      <input type="hidden"  value="<?php echo $_GET['aut_id'] ?>" name="aut"> 
                      <td class="textotablamenuform">Dominio/Patente</td>
                      <td class="textotablamenuform">
                           <input type="text" class="campo_form" value="<?php echo $regPer['patente'] ?>"  id="vendni" name="vendni" disabled style="width:80%;"> 
                          
                      </td>
                      <td class="textotablamenuform">Nombre y Apellido</td>
                      <td class="textotablamenuform" colspan="3">
                           <input type="text" class="campo_form"   name="venape" disabled value="<?php echo obtener_nombre_marca($regPer['idMarca'])." - ".obtener_nombre_modelo($regPer['idModelo'])." - ".obtener_nombre_version($regPer['idVersion']) ?>">
                               
                      </td> 
                   </tr>
                   
                   
                   
                   
                   
                   
               </table>    
           </fieldset>  
           </div>
           <fieldset>
           <legend><b>Detalle</b></legend> 
            <table  id="flex1">
                
                  <tr>
                 <td>
                 <select name="tipomov" class="campo_form">
               <!-- <option value="1" selected>Ingreso</option> -->
                 <option value="2">Egreso</option>
                 
                 </select>
                 </td>
                 <td>
                 <select name="tipo" class="campo_form">
                 <?php 
				 $resTipo=obtener_tipo_movimientos(2);
				 while($regMov=mysql_fetch_array($resTipo)):
				 ?>
                 <option value="<?php echo $regMov['tipoId'] ?>"><?php echo utf8_encode($regMov['tipoDescripcion']) ?></option>
                 <?php 
				 endwhile
				 ?>
                 
                 </select>
                 </td>
                 <td>
                 <input type="text" class="campo_form"  name="concepto" style=" width:340px;">
                 </td>
                  <td>
                  <input type="text" class="campo_form"  name="monto" style=" width:100px;">
                 </td>
                 </tr>
                 </table>
            </fieldset>
        
           <fieldset style="text-align: right;">  
            <table style="text-align: right;">
             <tr>
                    <td class="textotablamenuform" style="text-align: right;" colspan="5">
                         <input type="reset" name="enviar" value="Limpiar"  class="boton_form"/>
                         <input name="submit" id="submit" type="submit" value="Grabar Movimiento" class="boton_form"/>
                     </td>
                 </tr>
                   </table>       
           </fieldset>  
           
           
           
       </div>
   </form>
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
